package str

import (
	"strconv"
)

func AddStrings(num1 string, num2 string) string {
	right1 := len(num1)
	right2 := len(num2)
	res := ""
	andOne := 0
	for right1 >= 0 || right2 >= 0 || andOne != 0 {
		temp1 := 0
		temp2 := 0
		if right1 >= 0 {
			temp1 = int(num1[right1] - '0')
		}
		if right2 >= 0 {
			temp2 = int(num2[right2] - '0')
		}

		temp := temp1 + temp2 + andOne
		if temp >= 10 {
			temp = temp % 10
			andOne = 1
		} else {
			andOne = 0
		}
		res = strconv.Itoa(temp) + res
		right1--
		right2--
	}

	return res

}
